<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创建和删除节点</title>
	</head>
	<body>
		<input type="text" id="text" />
		<input type="button" onclick="remove()"value="删除"  />
		<input type="button" onclick="add()"value="添加"  />
		<ul id="a">
			
		</ul>
		<script>
			var text=document.getElementById('text');
			var ul=document.getElementById('a');
			function add(){
				var li=document.createElement('li');
				li.innerHTML=text.value;
				ul.appendChild(li);
			}
			function remove(){
				ul.lastElementChild.remove();
			}
			
		</script>
	</body>
	
</html>
